//
// Created by Scave on 2024/9/26.
//

#ifndef TIEC_MACRO_H
#define TIEC_MACRO_H
#include <string>
#include <memory>
#include <mutex>
#include <functional>

#define NS_TIEC tiec

#define PTR std::shared_ptr
#define UPTR std::unique_ptr
#define WPTR std::weak_ptr
#define MAKE_PTR std::make_shared
#define MAKE_UPTR std::make_unique
#define MAKE_WPTR std::make_weak
#define LOCK_GUARD(mtx) std::lock_guard<std:mutex> __lock(mtx);
#define LOCK_SHARED(mtx) std::shared_lock __lock(mtx);
#define LOCK_UNIQUE(mtx) std::unique_lock __lock(mtx);
#define LOCK_SCOPED(...) std::scoped_lock  __lock(__VA_ARGS__);
#define FUNCTION std::function
#define VOID_FUNCTION(...) std::function<void(__VA_ARGS__)>
#define PAIR std::pair

using String = std::string;
using WString = std::wstring;
using Int64 = int64_t;
using Int32 = int32_t;
#ifdef MACOS
#include <MacTypes.h>
#else
using UInt64 = uint64_t;
using UInt32 = uint32_t;
#endif

#define SAFE_DELETE_PTR(ptr) \
if (ptr != nullptr) {        \
  delete ptr;                \
}
#endif //TIEC_MACRO_H
